package com.android.plc.ui.control;

import android.content.Context;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;

import com.android.plc.CONST.COMMAND;
import com.android.plc.CONST;
import com.android.plc.R;

public class TVControl extends TVPlayControl implements OnClickListener
{
	private Button mTAVBtn;
	private Button mMuteBtn;
	
	public static final int OFFSET_3 = 3;
	public static final int OFFSET_4 = 4;

	public TVControl(Context context, ViewGroup view, int res_id)
	{
		super(context, view, res_id);
	}

	public TVControl(Context context, ViewGroup view)
	{
		super(context, view, R.layout.control_tv);
	}

	@Override
	public void initView(ViewGroup view)
	{
		super.initView(view);
		
		mTAVBtn = (Button) view.findViewById(R.id.btn_tv_av);
		mMuteBtn = (Button) view.findViewById(R.id.btn_tv_mute);

		mTAVBtn.setOnClickListener(this);
		mMuteBtn.setOnClickListener(this);
	}

	public void onClick(View v)
	{
		switch (v.getId())
		{
		case R.id.btn_tv_av:
			sendCommand(OFFSET_3, COMMAND.ON, CONST.DEF_DATA, 0);
			break;
		case R.id.btn_tv_mute:
			sendCommand(OFFSET_3, COMMAND.OFF, 0, 0);
			break;
		default:
			super.onClick(v);
			break;
		}
	}
}
